package com.amon.optimize.plugin

import com.android.build.gradle.AppExtension
import org.gradle.api.Plugin
import org.gradle.api.Project

class ImageMonitorPlugin implements Plugin<Project> {
    String EXT_NAME = "imageMonitor"

    @Override
    void apply(Project project) {
        def extension = project.extensions.create(EXT_NAME, ImageMonitorExtension)
        println("monitorClass:" + extension.getProperty("monitorClass"))
        if (extension.monitorClass != '') {
            def android = project.extensions.getByType(AppExtension)
            android.registerTransform(new ImageMonitorTransform(project, extension.monitorClass))
        }
    }
}